//
//  MiTuGiftTool.swift
//  MT
//
//  Created by ooops on 2020/5/25.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation
import Result

class MiTuGiftTool: NSObject { }


extension MiTuGiftTool {
    
    ///  获取创建聚会任务礼物数据
    /// - Parameters:
    ///   - provider: provider description
    ///   - complete: complete description
    ///   - failure: failure description
    class func pullPartyGift(provider: MTProvider<MiTuGiftApi>,
                                complete: @escaping (MiTuGiftResponseModel?) -> Swift.Void,
                                failure: @escaping (AnyError) -> Swift.Void) {
        provider.rx.requestResult(.partyGift).subscribe(onNext: { (result:Result<MiTuGiftResponseModel, AnyError> , isCache:Bool) in
            switch result {
            case .success(let model):
                complete(model)
            case .failure(let error):
                failure(error)
                break
            }
            
        }).disposed(by: globalDisposedBag)
        
    }
    
}
